package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.BaseCategory3;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BaseCategory3Mapper extends BaseMapper<BaseCategory3> {
  // SQL也可以不写到xml中,但是这样不能自定义结果集
  // @Select(
  //     "select\n"
  //         + "            bc3.*\n"
  //         + "        from base_category2 bc2\n"
  //         + "                 inner join base_category3 bc3 on category2_id = bc2.id\n"
  //         + "        where category1_id = #{category1Id}\n"
  //         + "          and bc2.is_deleted = 0\n"
  //         + "          and bc3.is_deleted = 0\n"
  //         + "        order by is_top\n"
  //         + "        limit 7")
  List<BaseCategory3> findTopBaseCategory3(@Param("category1Id") Long category1Id);


}
